<?php
require_once ('admin.php');
$sucessful = 0;
$error = array();
$fileName = '';
$ok = 1;
/*
 * Submit
 */
if (isset($_REQUEST['publish_product'])) {

    if ($_REQUEST['name'] == "") {

        $error['name'] = "Name can not be blank";
        $ok = 0;
    }

    if ($_REQUEST['email'] == "") {

        $error['email'] = "Email can not be blank";
        $ok = 0;
    } else {

        $email_address = $_REQUEST['email'];
        if (!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email_address)) {
            $error['email'] = "\nInvalid email address";
            $ok = 0;
        }
    }



    if ($_REQUEST['phone'] == "") {
        $error['phone'] = 'Going to can not be blank';
        $ok = 0;
    }

    if ($_REQUEST['address'] == "") {
        $error['address'] = 'Address to can not be blank';
        $ok = 0;
    }



    // echo $featured;
    if ($ok == 1) {
        $fullName = $_REQUEST['name'];
        $email = $_REQUEST['email'];
        $address = $_REQUEST['address'];
        $phone = $_REQUEST['phone'];
        $sucessful = 1;
        RequestAQoute::insertRequestAQuoteAdmin($fullName, $email,$address, $phone);
        header('Location:customer-list.php');
    }
}

/**
 * Link Management Administration Screen.
 */
/** Load WordPress Administration Bootstrap */
global $current_user;
$featured = DealFlight::FEATURED_NO;
?>
<?php
$wp_list_table = _get_list_table('WP_Links_List_Table');
$doaction = $wp_list_table->current_action();

if ($doaction && isset($_REQUEST['linkcheck'])) {
    check_admin_referer('bulk-bookmarks');
    if ('delete' == $doaction) {
        $bulklinks = (array) $_REQUEST['linkcheck'];
        foreach ($bulklinks as $link_id) {
            $link_id = (int) $link_id;
            wp_delete_link($link_id);
        }
        wp_redirect(add_query_arg('deleted', count($bulklinks), admin_url('link-manager.php')));
        exit;
    }
} elseif (!empty($_GET['_wp_http_referer'])) {
    wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI'])));
    exit;
}
$wp_list_table->prepare_items();
$title = __('Add customer');
$this_file = $parent_file = 'customer-list.php';
get_current_screen()->add_help_tab(array(
    'id' => 'overview',
    'title' => __('Overview'),
    'content' =>
    '<p>' . sprintf(__('You can add links here to be displayed on your site, usually using <a href="%s">Widgets</a>. By default, links to several sites in the WordPress community are included as examples.'), 'widgets.php') . '</p>' .
    '<p>' . __('Links may be separated into Link Categories; these are different than the categories used on your posts.') . '</p>' .
    '<p>' . __('You can customize the display of this screen using the Screen Options tab and/or the dropdown filters above the links table.') . '</p>'
));

get_current_screen()->add_help_tab(array(
    'id' => 'deleting-links',
    'title' => __('Deleting Links'),
    'content' =>
    '<p>' . __('If you delete a link, it will be removed permanently, as Links do not have a Trash function yet.') . '</p>'
));



get_current_screen()->set_help_sidebar(
        '<p><strong>' . __('For more information:') . '</strong></p>' .
        '<p>' . __('<a href="http://codex.wordpress.org/Links_Screen" target="_blank">Documentation on Managing Links</a>') . '</p>' .
        '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
);


if (!current_user_can('read'))
    wp_die(__("You do not have sufficient permissions to edit the links for this site."));
?>



<?php include_once ('./admin-header.php'); ?>
<link rel="stylesheet" type="text/css" href="css/tuan.css"/>

<div class="wrap nosubsub">
    <h2>Add Customer<?php
if (!empty($_REQUEST['s']))
    printf('<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html(wp_unslash($_REQUEST['s'])));
?>
    </h2>
    <form id="posts-filter" method="post"  enctype="multipart/form-data"> 
<?php $wp_list_table->search_box(__('Search Links'), 'link'); ?>
        <hr>
        <div style="width:100%; background:#FDFDFD">
            <table width="707"  height="77" cellspacing="0" >
                <tr>
                    <th width="138" valign="top"  scope="row" align="left">
                        <label for="siteupdates">
                            <p class="labelp"><?php _e('Name') ?> (*)</p>  
                        </label>
                    </th>
                    <td width="563"  valign="top">
                        <div style="margin-top:10px;">:  			    
                            <input  style="width:80%; height:30px;" name="name" type="text" id="name"   
                                    value="<?Php
if (isset($_POST['name'])) {
    echo $_POST['name'];
}
?>"  class="regular-text"> 
                            <span class="errorclass"><Br/><?php echo $error['name']; ?></span>
                        </div>
                    </td>
                </tr>

                <tr>
                    <th width="138" valign="top"  scope="row" align="left">
                        <label for="siteupdates">
                            <p class="labelp" ><?php _e('Email'); ?> (*)</p> 
                        </label>
                    </th>
                    <td width="563"  valign="top">
                        :
                        <input  style="width:80%; height:30px;" name="email" type="text" id="email"   
                                value="<?Php
                                    if (isset($_POST['email'])) {
                                        echo $_POST['email'];
                                    }
?>"  class="regular-text"> 
                        <span class="errorclass"><Br/><?php echo $error['email']; ?></span>
                    </td>
                </tr>
                <tr>
                    <th width="138" valign="top"  scope="row" align="left"><label for="siteupdates">
                            <p class="labelp" ><?php _e('Address') ?>
                                (*)</p> </label>
                    </th>
                    <td width="563"  valign="top">
                        <div style="margin-top:10px; margin-left:5px;">:
                            <input type='text' style="width:80%; height:30px;"  name='address' value='<?php echo $_POST['address'] ?>'/>
                            <span class="errorclass"><br/><?php echo $error['address']; ?></span>
                        </div>
                    </td>
                </tr>

                <tr>
                    <th width="138" valign="top"  scope="row" align="left"><label for="siteupdates">
                            <p class="labelp" ><?php _e('Phone') ?>
                                (*)</p> </label>
                    </th>
                    <td width="563"  valign="top">
                        <div style="margin-top:10px; margin-left:5px;">:
                            <input type='text' style="width:80%; height:30px;"  name='phone' value='<?php echo $_POST['phone'] ?>'/>
                            <span class="errorclass"><br/><?php echo $error['phone']; ?></span>
                        </div>
                    </td>
                </tr>


                <tr>
                    <th valign="top"  scope="row" align="left">&nbsp;</th>
                    <td  valign="top"><div style="margin-top:10px; margin-left:5px;">
                            <input type="submit" name="publish_product" id="publish_product" 
                                   class="button button-primary button-large" value="ADD" accesskey="p"></div>
                    </td>
                </tr>
            </table>
        </div>
    </form>

</div>

<link rel="stylesheet" type="text/css" href="../wp-content/themes/travel_donald/css/jquery.datetimepicker.css" />
<script src="../wp-content/themes/travel_donald/js/jquery.js"></script>
<script src="../wp-content/themes/travel_donald/js/jquery.datetimepicker.js"></script>

<script type="text/javascript" lang="javascript">

    $('#image_bt_start_time').click(function() {
        $('#start_time').datetimepicker('show'); //support hide,show and destroy command
    });


    $('#image_bt_end_time').click(function() {
        $('#end_time').datetimepicker('show'); //support hide,show and destroy command
    });


    $(function() {
        $('#start_time').datetimepicker({
            format: 'Y/m/d',
            onShow: function(ct) {
                this.setOptions({
                    maxDate: $('#end_time').val() ? $('#end_time').val() : false
                })
            },
            timepicker: false
        });
        $('#end_time').datetimepicker({
            format: 'Y/m/d',
            onShow: function(ct) {
                this.setOptions({
                    minDate: $('#start_time').val() ? $('#start_time').val() : false
                })
            },
            timepicker: false
        });
    });





</script>



<?php
include('./admin-footer.php');
?>

